package mylab.commons.web.mvc.entity;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import mylab.base.model.entity.LongIdEntity;
import mylab.commons.api.model.Group;

import java.util.List;

@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public abstract class BaseGroupEntity<T extends BaseEntity>
        extends BaseNestedEntity<T> implements Group<T> {

    public abstract List<String> getItemIds();

    @Override
    public List<T> getItems() {
        return getMapper().selectBatchIds(getItemIds());
    }

}
